A. Field of the Invention
The invention relates generally to a memory card controller that manages a file allocation table, descriptor files and system area of a memory card.
B. Description of the Related Art
Memory cards are becoming more and more prevalent for use by various types of devices. Such devices include digital music players and cameras, personal digital assistants (PDAs), video cameras, cellular phones, and other digital consumer electronics products.
Memory cards are useful in that they are easily inserted and removed from host devices. Memory cards may be of the flash-memory variety, or of another type of memory storage capability. Memory cards provide a compact, reliable, and easy-to-use storage medium to store large amounts of video, audio, and other data for various types of host devices.
When a host device obtains information from a memory card, or when the host device seeks to write data to the memory card, an interface between the host device and the memory card is utilized in order to deal with the potentially different bus sizes and the potentially different data transfer protocols utilized by the two devices. A memory card controller is used as an interface for the transfer of data from the memory card to the host device and for the transfer of data from the host device to the memory card.
For example, a memory card controller provides a multi-block read/write capability for data to be read into or to be read from a memory card, such as on a sector-by-sector basis. Based on an access command output by the host device, the memory card controller accesses storage locations of the memory card in order to accommodate the access command. As explained above, the access command may be for a write of data to the memory card, or for a read of data from the memory card.
The memory card controller manages the interface between the memory card and the host device, and is tied to that interface. The memory card controller includes a memory for storing data to be written into the memory card or to be read from the memory card, and functions as a buffer between these two devices. The memory card controller also includes a processor that performs various access functions on the memory card based on access requests made by the host device.
Many conventional host devices use the structures defined in ISO Standard 9293 or similar standards to manage the files on the memory card. This standard defines the FDC Descriptor, System Area, Root Directory and file allocation table (FAT) as the structures to be maintained. When such a host device seeks to either write data to a memory card or to read data from the memory card, the host device must first obtain the FAT from the memory card. If the memory card is not formatted, then the host device must format the memory card and set up a memory region in the memory card where the FDC Descriptor, System Area, Root Directory and FAT is to be stored.
The host device prepares the FAT, or obtains a previously-prepared FAT from the memory card. Once the FAT has been read from the memory card to the host device, the host device determines available memory space in the memory card to write a particular-sized file to (for a memory write operation), or the host device determines where in the memory card a particular file is stored (for a memory read operation). With this information, the host device can send the appropriate access commands to the memory card controller to obtain a desired file currently stored on the memory card, or it can send the appropriate access commands to the memory card controller to write a file onto an available unused region (e.g., one or more sectors or clusters) of the memory card.
The inventor of the present invention has realized that, due to the larger-sized FATs that are currently being used or considering to be used for large-storage-capacity memory cards using many of the available host interfaces, the time to transfer an entire FAT from a memory card to a host device can be fairly long (e.g., several seconds or more), which is an undesired feature. Thus, the present invention provides for file management of the memory card in a quicker and more efficient way.
According to one aspect of the invention, there is provided a memory card controller, which includes a memory that stores a FDC Descriptor, System Area, Root Directory (called file system structures hereon after) and file allocation table for a memory card to be controlled by the memory card controller. The memory card controller also includes a processor that manages the file allocation table and file system structures based on requests made by a host with respect to information to be retrieved from the memory card or with respect to information to be stored on the memory card.
According to another aspect of the invention, there is provided a method of determining whether a file write request output from a host device for writing a file to a memory card can be accommodated. The method includes a step of obtaining, by a memory card controller that provides a communications interface between the memory card and the host device, a file allocation table (FAT) and file system structures stored on the memory card. The method also includes a step of storing the FAT and file system structures on the memory card controller. The method further includes a step of determining, by the memory card controller based on information obtained from the FAT, whether the memory card has sufficient available storage space to fulfill the file write request made by the host device. The method still further includes a step of informing the host device as to whether or not the file write request can be fulfilled.
According to yet another aspect of the invention, there is provided a method of determining whether a file read request output from a host device for reading a file from a memory card can be accommodated. The method includes a step of obtaining, by the host device, information regarding names of files stored on the memory card. The method also includes a step of outputting, by the host device, the memory read request to read a particular one of the files stored on the memory card. The method further includes a step of obtaining, by a memory card controller that provides a communications interface between the memory card and the host device, a file allocation table (FAT) and file system structures stored on the memory card to determine storage locations on the memory card whereby the particular one of the files is stored. The method still further includes a step of storing the FAT and file system structures on the memory card controller. The method also includes a step of providing the particular one of the files to the host device from the memory card to the host device, under control of the memory card controller.
According to yet another aspect of the invention, there is provided a method of determining whether a file copy request from a host device for copy a file from a memory card can be accommodated. The method includes a step of obtaining, by the host device, information regarding names of file to be copied on the memory card. The method still further includes a step of determining where within the FAT on the memory card controller the file to be copied is located and assessing how much space the file occupies. The method further includes a step of determining, by the memory card controller based on information obtained from the FAT, whether the memory card has sufficient available storage space to fulfill the file copy request made by the host device. The method still further includes a step of informing the host device as to whether or not the file copy request can be fulfilled. The method also includes a step of, under control of the memory card controller, copying the file to a new location and updating the FAT and file system structures to record the location of the copied file.
According to yet another aspect of the invention, there is provided a method of determining whether a file move request from a host device for copy a file from a memory card can be accommodated. The method includes a step of obtaining, by the host device, information regarding names of file to be moved on the memory card and the directory location. The method still further includes a step of determining where within the FAT on the memory card controller the file to be moved is located. The method also includes a step of, under control of the memory card controller, moving the file to a new location and updating the FAT and file system structures to record the location of the moved file.
According to yet another aspect of the invention, there is provided a method of determining whether a file delete request from a host device for deleting a file from a memory card can be accommodated. The method includes a step of obtaining, by the host device, information regarding names of files to be deleted on the memory card. The method still further includes a step of determining where within the FAT on the memory card controller the file to be deleted is located. The method also includes a step of, under control of the memory card controller, updating the FAT and file system structures to remove the requested file.